//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "FormUtilities.h"

void TFormUtilities :: LocateForm( TForm * parent, TForm * child)
{
   child->Top = parent->Top + ( parent->Height - parent->ClientHeight);
   child->Left = parent->Left + ( parent->Width - parent->ClientWidth);
}

void TFormUtilities :: SetLastColumnWidth( TStringGrid * grid)
{
   int total;
   int i;
   
   total = 0;
   grid->ColWidths[ grid->ColCount - 1] = 0;

   for ( i = 0; i < grid->ColCount; i++)
   {
      total = total + grid->ColWidths[ i];
   }//for

   if ( grid->Options.Contains( goVertLine) ||
        grid->Options.Contains( goFixedVertLine))
   {
      i = grid->ClientWidth - total - grid->ColCount * grid->GridLineWidth;
   }
   else
   {
        i = grid->ClientWidth - total;
   }//if-else

   if ( i >= 0)
   {
      grid->ColWidths[ grid->ColCount - 1] = i;
   }
}

//---------------------------------------------------------------------------

#pragma package(smart_init)
